#pragma once
#include <glm/glm.hpp>
#include "Hazel/Core/Timestep.h"
namespace Hazel
{
	class Camera
	{
	public:
		Camera(float verticalFOV, float nearClip, float farClip);

		bool OnUpdate(Timestep ts);
		const glm::mat4& GetProjection() const { return m_Projection; }
		const glm::mat4& GetView() const { return m_View; }
		const glm::mat4& GetInverseProjection() const { return m_InverseProjection; }
		const glm::mat4& GetInverseView() const { return m_InverseView; }

		const glm::vec2& GetMouseLastPosition() { return m_LastMousePosition; }

		const glm::vec3& GetPosition() const { return m_Position; }
		const glm::vec3& GetDirection() const { return m_ForwardDirection; }

		const std::vector<glm::vec3>& GetRayDirections()const { return m_RayDirections; }

		float GetRotationSpeed();

		void OnResize(uint32_t width, uint32_t height);
	private:
		void RecalculateProjection();
		void RecalculateView();
		void RecalculateRayDirections();
	private:
		glm::mat4 m_Projection{ 1.0f };
		glm::mat4 m_View{ 1.0f };
		glm::mat4 m_InverseProjection{ 1.0f };
		glm::mat4 m_InverseView{ 1.0f };

		float m_VerticalFOV = 45.0f;
		float m_NearClip = 0.1f;
		float m_farClip = 100.0f;

		glm::vec3 m_Position{ 0.0f };
		glm::vec3 m_ForwardDirection{ 0.0f,0.0f,-1.0f };

		std::vector<glm::vec3> m_RayDirections;

		glm::vec2 m_LastMousePosition{ 0.0f, 0.0f };

		uint32_t m_ViewPortWidth = 1280, m_ViewPortHeight = 720;
	};
}

